home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / CALib & You… / Documentation / CALib API⁄Source Reference 2 < prev    next >
Encoding:
Text File  |  1995-12-15  |  11.7 KB  |  327 lines  |  [TEXT/ttxt]

  1. CALib API/Source Reference - Part 2
  2. By The OpenDoc™ Engineering Team
  3. December 15, 1995
  4.  
  5.  
  6. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9. ----------------------------------------------------------------------------------------------------------------------------
  10.  
  11.  
  12. CALib API (continued)
  13.  
  14. Menus    - CAMenu.cpp
  15.  
  16. Description
  17.  
  18. All menu events are dispatched to OpenDoc via CADispatchMenuEvent().  CADispatchEvent() will
  19. ignore both mouse down events in the menu bar, and menu command-key events.
  20.  
  21. CASetBaseMenuBar is called with the CA's menu bar resource handle.  The CASession object builds
  22. a base menu bar (Apple, File, Edit) and assigns it to the ODWindowState, it then creates an ODMenuBar object for the CA menu bar and sets it as the current menubar.  At initialization the proxy part stores the CA menu bar so it can be displayed when the root frame acquires menu focus.
  23.  
  24. CAAdjustMenus() is called by the CA when a mousedown in the menubar occurs.
  25.  
  26.  
  27. API
  28.  
  29. pascal void    CASetBaseMenuBar( ODPlatformMenuBar menuBar )
  30. Registers the CA menu bar with OD so that the menu bar can be shared with embedded parts.  menuBar should
  31. be a handle to the CA's MenuBar resource.
  32. Exceptions signaled:
  33.     none
  34.  
  35. pascal void    CAAdjustMenus()
  36. When the user clicks in the menubar, call CAAdjustMenus() before calling MenuSelect.
  37. Exceptions signaled:
  38.     none
  39.  
  40. pascal void    CARegisterCommand(     CACommandID command, 
  41.                     CAMenuID menu,
  42.                     CAMenuItemID menuItem )
  43. Used to register a menu pick as an command ID with the OD menubar RegisterCommand call. All shared real-estate furnished by the CA (File/Document & Edit menus) must contain the minimum required entries and each MUST be registered using this call.
  44. Exceptions signaled:
  45.     none
  46.  
  47. pascal Boolean    CADispatchMenuEvent(    EventRecord* event, 
  48.                     long menuSelection )
  49. Used to pass menu event from CA to OD for embedded parts. ANY mousedown within the CA menubar must be transformed and passed in through this routine.
  50. Exceptions signaled:
  51.     none
  52.  
  53.  
  54.  
  55. Stream    - CAStream.cpp
  56.  
  57. Description
  58.  
  59. The Stream API handles streaming to/from OpenDoc storage unit value streams.  Each CADocument object
  60. maintains a current value and stream offset associated with that document.  The CA may change the
  61. current value via CASetDocumentKind() and the current stream offset via CASetOffset().
  62.  
  63. For CA's which choose to store their CA documents as OpenDoc documents, the Stream API is used to
  64. write the CA data stream to the CADocument.  
  65.  
  66. API
  67.  
  68. pascal void    CARead(     CADocumentRef document,
  69.                 char        *buffer,
  70.                 CASize        *length )
  71. Exceptions signaled:
  72.     kCAErrEndOfFile
  73. Attempts to reads length bytes from document’s value stream.  Upon return, length contains the number of bytes actually read.
  74.  
  75.  
  76. pascal void    CAWrite(     CADocumentRef document,
  77.                 char        *buffer,
  78.                 CASize        *length )
  79. Exceptions signaled:
  80.     none
  81. Writes length bytes to the document’s value stream.
  82.  
  83. pascal CASize    CAGetSize(         CADocumentRef document )
  84. Exceptions signaled:
  85.     none
  86. Returns the size (length) of document’s value stream.
  87.  
  88. pascal CASize    CAGetOffset(         CADocumentRef document )
  89. Exceptions signaled:
  90.     none
  91. Returns the current offset of document’s value stream.
  92.  
  93. pascal void    CASetOffset(        CADocumentRef document, 
  94.                     CASize        offset )
  95. Exceptions signaled:
  96.     kCAErrEndOfFile
  97. Sets the current offset of document’s value stream.
  98.  
  99. pascal void    CAInsert(     CADocumentRef document,
  100.                 char*        buffer,
  101.                 CASize*        length )
  102. Exceptions signaled:
  103.     none
  104. Inserts length bytes into document’s value stream at the current offset.
  105.  
  106. pascal void    CADelete(     CADocumentRef document,
  107.                 char*        buffer,
  108.                 CASize*        length )
  109. Exceptions signaled:
  110.     none
  111. Deletes length bytes from document’s value stream at the current offset.
  112.  
  113.  
  114. User Interface    - CAUIEvt.cpp
  115.  
  116. Description
  117.  
  118. CAs continue to own the event loop. The major change is that the OpenDoc dispatcher should be given a chance to handle an event before the CA tries to handle it. If the dispatcher hasn’t handled it, the CA is free to. To make this work, the proxy part should simply answer FALSE for all HandleEvent calls, so that the CA can get a chance at them.
  119. For the dispatcher to be able to find windows to dispatch events to, the CA must register all windows. This works for floating windows too.
  120. There are getters for the sleeptime and mouseregion which the CA can pass to Get/WaitNextEvent();
  121.  
  122. API
  123. The  mouse region (returned by CAGetMouseRegion) should be passed in to  the CA’s WaitNextEvent call  if notification is desired when the mouse is moved out of the current part’s facet. The sleep time should always be passed to the GetNextEventCall...
  124.  
  125.  
  126. pascal Boolean    CADispatchEvent( EventRecord* event, CAEventInfo* eventInfo )
  127. Used to pass events received by the CA on into the embedded parts for processing. Returns TRUE if  the event has been handled, FALSE if the CA must process the event.  eventInfo is filled in appropriately.
  128. Exceptions signaled:
  129.     none
  130.  
  131. pascal RgnHandle CAGetMouseRegion()
  132. This returns the visible region of the facet surrounding/containing the cursor
  133. Exceptions signaled:
  134.     none
  135.  
  136. pascal long    CAGetSleepTime()
  137. returns the minimum of _(RegisterIdle time)_ and    (Caret time)   
  138. Exceptions signaled:
  139.     none
  140.  
  141. pascal void    CAInstallBorderAdjuster(     CAAdjustBorderProc theProc)
  142. Allows CA to receive a callback for  modification of  the border shown when an embedded part is activated/deactivated or selected/deselected.
  143. Exceptions signaled:
  144.     kCAErrInvalidHandler
  145.  
  146. pascal void    CAAdjustActiveBorder(     CADocumentRef document, 
  147.                         CAFrameRef    frame,
  148.                         RgnHandle    border )
  149. used to manually change the border when the border adjuster proc is not installed.
  150. Exceptions signaled:
  151.     none
  152.  
  153.  
  154. Undo    - CAUndo.cpp
  155. CAs can play with the OpenDoc undo strategy — however, there is no support for multiple undos hopping between CA and OD. Any undoable action in the CA’s native content will clear the OpenDoc undo stack. Undo menu events go first to the OD dispatcher. If the undo stack is clear, the event is passed to the CA.
  156.  
  157. API
  158.  
  159. pascal void    CAClearUndo()
  160. Exceptions signaled:
  161.     none
  162.  
  163.  
  164.  
  165. Window    - CAWindow.cpp
  166.  
  167. Apps need to be aware of dependent or floating windows that parts may have opened. The application can make CALib calls to determine whether a window belongs to an OpenDoc part, find the frontmost non-floating window, activate a window, etc.
  168. If an application does not have its own floating window support, CALib will use its own (based on the intrinsic support in the UI subsystem.) If an application already supports floating windows, we can't have two competing floating window managers so CALib will have to use the application's scheme. The application registers callbacks to its floating window management functions, and CALib will respect those callbacks.
  169.  
  170. Floating windows talk to OpenDoc API.  Refer to Window Management callbacks.
  171.  
  172. The WindowActivate handler is a REQUIRED callback which must be implemented by the CA in order to receive activate/deactivate events due to OpenDoc internal design.
  173.  
  174.  
  175. CAInstallFloatingWindowHandlers - TBD (not yet implemented).
  176.  
  177. API
  178.  
  179. pascal void    CAInstallFloatingWindowHandlers(     CAFrontWindowProc    fw,
  180.                             CASelectWindowProc    sw,
  181.                             CAIsFloaterProc    isf )
  182. Registers CA floating window handlers with OpenDoc so that the windows can be made to go away when an embedded part is activated, etc...
  183. Exceptions signaled:
  184.     kCAErrExistingHandler
  185.  
  186. pascal    OSErr        CAInstallWindowActivateHandler (CAWindowActivateHandler,
  187.         CADocumentRef);
  188. Called when a window is activated, deactivated by the internalWindowState.  OpenDoc does not generate activate events. The WindowActivateHandler needs to call the CA's window activation/deactivation methods (if any).  This is the only method of being notified of some OpenDoc internal activation events.
  189.  
  190. pascal CAWindowLayer    CAIsPartWindow(     WindowPtr w )
  191. Returns a WindowLayer if the window belongs to an embedded part...
  192. Exceptions signaled:
  193.     none
  194.  
  195. pascal WindowPtr CAGetFrontDocWindow( void )
  196. Returns the frontmost document window, not including floating windows/palettes... Returns Nil of no windows are open.
  197. Exceptions signaled:
  198.     none
  199.  
  200. pascal WindowPtr CAGetFrontFloatingWindow( void )
  201. Returns the window pointer for the top most floater...Nil if none...
  202. Exceptions signaled:
  203.     none
  204.  
  205. pascal void    CASelectWindow( WindowPtr w )
  206. If the window is a document window, brings it to the front of all other document windows and activates it. If the window is a floater, brings it to the front of all floating windows.
  207. Exceptions signaled:
  208.     none
  209.  
  210. pascal void    CARegisterRootWindow(     WindowPtr window,
  211.                         CADocumentRef document )
  212. Registers CA rootwindow  with OpenDoc so that the windows can be made to go away when an embedded part is activated, etc...
  213. Exceptions signaled:
  214.     none
  215.  
  216. pascal void    CARegisterFloatingWindow(     WindowPtr window )
  217. Registers CA floating window  with OpenDoc so that the windows can be manipulated...
  218. Exceptions signaled:
  219.     none
  220.  
  221. pascal void    CAUnregisterWindow(     WindowPtr window )
  222. Removes CA window  from OpenDoc so that the windows can be made to go away when a document is closed, etc...
  223. Exceptions signaled:
  224.     none
  225.  
  226.  
  227.  
  228. CALib Private Modules
  229.  
  230.  
  231. CAError.cpp
  232.  
  233. Description
  234.  
  235. This module contains CALib internal methods and macro definitions for failure handling.
  236.  
  237. CALib's failure handling mechanism CA_TRY, CA_CATCH_ALL and CA_ENDTRY is utilized in nearly all CALib functions.  These macros automatically setup the global CA error value to be accessed by the CA.
  238.  
  239.  
  240. API
  241.  
  242. void     ClearCAError( )
  243. Resets the global error variable. (Internal API only)
  244. Exceptions signaled:
  245.     none
  246.  
  247. void    SetCAError( OSErr err )
  248. Default callback proc used by CALib. (Internal API only)
  249. Exceptions signaled:
  250.     none
  251.  
  252.  
  253. CADocPriv.cpp
  254.  
  255. Description
  256.  
  257. This module contains CADocument class implementations.  CADocument, CAClipboardDocument, and CADragDropDocument are used internally by CALib. 
  258.  
  259.  
  260.  
  261. CADisptch.cpp
  262.  
  263. Contains the CADispatcher class implementation.
  264.  
  265.  
  266. CAFileUtils.cpp
  267.  
  268.  
  269. File utility routines (previously contained by proxy shell).
  270.  
  271. void CreateUntitledContainer(    Environment* ev,
  272.                     ODSession*    session,
  273.                     ODDocument** documentPtr,
  274.                     ODContainer** containerPtr,
  275.                     PlatformFile* newFile,
  276.                     ODName* fileNameSeed);
  277.  
  278. ODFileSpec CreateTempContainer(    Environment* ev,
  279.                     ODSession*    session,
  280.                     ODDocument** documentPtr,
  281.                     ODContainer** containerPtr);
  282.  
  283. PlatformFile*    CreateTempFile(    ODOSType creator,
  284.                     ODOSType fileType,
  285.                     fileNameSeed);
  286.  
  287. PlatformFile*    CreatePartFromStationary (PlatformFile* file, ODPart** part);
  288.  
  289.  
  290. CAFrmUtil.cpp
  291.  
  292. This module contains CALib internal routines to handle mapping to/from CAFrameRef's, ODFrame*'s and ODID's.
  293.  
  294. A CAFrameRef is a StrongStorageUnitRef to an ODFrame, associated with the first value in the kODPropContents property of the proxy part. A CAFrameRef represents to the CA a persistent reference to a frame (valid across saves).
  295.  
  296.  
  297. API
  298.  
  299. ODFrame*    AcquireFrameFromFrameRef(CADocumentRef document, CAFrameRef frameRef)
  300. CAFrameRef    FrameRefFromFrame(    ODFrame* frame, CADocumentRef document)
  301. ODFacet*    FacetFromFrameRef (CADocumentRef document, CAFrameRef frame)
  302. void        GetFrameRefFromID(CADocumentRef document, ODID frameID, CAFrameRef frameRef)
  303. ODID        GetIDFromFrameRef(CADocumentRef document, CAFrameRef frameRef)
  304. ODFrame*    GetRootFrame( CADocumentRef document )
  305.  
  306.  
  307.  
  308. CASession.cpp
  309.  
  310.  
  311. This module the CASession class implementation.
  312. CAUtil.cpp
  313.  
  314. This module contains miscellaneous utility routines used internally by CALib.
  315.  
  316. void        CallProxyUpdate(    CADocumentRef document, ODFrame* frame)
  317. void        CallProxyAddFrame(    CADocumentRef    document, ODFrame* frame);
  318.  
  319. void        GetEventInfo(        CADocumentRef document, ODEventInfo* eventInfo);
  320.  
  321. Boolean        IsCAProxyPartDraft(    ODDraft* draft);
  322. Boolean        IsCAProxyPart(        ODPart*  part);
  323.  
  324.  
  325. CAWinStat.cpp
  326.  
  327. This module contains the CAWinStat implementation.  The OpenDoc WindowState class is overridden with the CAWindowState class.